package com.yuanfeng.commoms.util;

import org.springframework.util.StringUtils;

import java.util.regex.Pattern;

public class CheckPhoneUtil {

    private static final String pattern = "^((1[2,3,4,5,7,6,8,9][0-9]))\\d{8}$";

    public static Boolean checkPhone(String phone) {
        //长度和不为空
        if (StringUtils.isEmpty(phone))
            return false;
        if (phone.trim().length() != 11)
            return false;
        return Pattern.matches(pattern, phone);
    }

}
